FUNCTION iniReadReal &
!
(key, iniDB, section, subSection, default)
IMPLICIT NONE
! subroutine arguments
! Scalar arguments with intent(in):
CHARACTER (LEN = *), INTENT(IN) :: key
TYPE (IniList ) , INTENT(IN) :: iniDB
CHARACTER (LEN = *), OPTIONAL, INTENT(IN) :: section
CHARACTER (LEN = *), OPTIONAL, INTENT(IN) :: subSection
REAL(KIND = float) , OPTIONAL, INTENT(IN) :: default
! Scalar arguments with intent(out):
REAL (KIND = float) :: IniReadReal
!Local Scalars:
CHARACTER(LEN = stringLen) :: s
!------------end of declaration------------------------------------------------
IF ( PRESENT (section) .AND. PRESENT (subSection) ) THEN
s = IniReadString(key, iniDB, section = section, subSection = subSection)
ELSE IF ( PRESENT (section) .AND. .NOT.PRESENT (subSection)) THEN
s = IniReadString(key, iniDB, section = section)
ELSE
s = IniReadString(key, iniDB)
ENDIF
IF (s == '') THEN
IF ( PRESENT (default) )THEN
IniReadReal = default
ELSE
CALL Catch ('error', 'read ini file', &
'key not found: ' , code = iniIOError, &
argument = key )
ENDIF
ELSE
READ (s,*, IOSTAT = ios) IniReadReal
IF (ios > 0) THEN
CALL Catch ('error', 'read ini file', &
'error reading real for key: ' , &
code = iniIOError, argument = key )
ENDIF
END IF
RETURN
END FUNCTION IniReadReal